# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=litehtml
pkgver=0.7
pkgrel=1
pkgdesc='Fast and lightweight HTML/CSS rendering engine'
url='http://www.litehtml.com/'
arch=(x86_64)
license=(BSD)
depends=(gumbo-parser gcc-libs)
makedepends=(cmake)
source=(https://github.com/litehtml/litehtml/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('4f561dfa616d7fefb732fe9f40d4da9f0ec3925456ea42346d8aa10e946ef7ba')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DEXTERNAL_GUMBO=ON \
    -DLITEHTML_UTF8=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_TESTING=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 $pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
# Don't search for non-existant gumbo cmake config
  sed -e '/gumbo/d' -i "$pkgdir"/usr/lib/cmake/litehtml/litehtmlConfig.cmake
}
